package com.ruoyi.deal.service.impl;

import java.util.List;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.deal.domain.CcsReceiveLocation;
import com.ruoyi.deal.mapper.CcsReceiveLocationMapper;
import com.ruoyi.deal.service.ICcsReceiveLocationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 收货地址Service业务层处理
 *
 * @author ruoyi
 * @date 2024-10-17
 */
@Service
public class CcsReceiveLocationServiceImpl implements ICcsReceiveLocationService
{
    @Autowired
    private CcsReceiveLocationMapper ccsReceiveLocationMapper;

    @Override
    public AjaxResult getReceiveLocationsVOByUserId(Long userId) {
        return AjaxResult.success(ccsReceiveLocationMapper.selectReceiveLocationsVOByUserId(userId));
    }

    /**
     * 查询收货地址
     *
     * @param id 收货地址主键
     * @return 收货地址
     */
    @Override
    public CcsReceiveLocation selectCcsReceiveLocationById(Long id)
    {
        return ccsReceiveLocationMapper.selectCcsReceiveLocationById(id);
    }

    /**
     * 查询收货地址列表
     *
     * @param ccsReceiveLocation 收货地址
     * @return 收货地址
     */
    @Override
    public List<CcsReceiveLocation> selectCcsReceiveLocationList(CcsReceiveLocation ccsReceiveLocation)
    {

        return ccsReceiveLocationMapper.selectCcsReceiveLocationList(ccsReceiveLocation);
    }

    /**
     * 新增收货地址
     *
     * @param ccsReceiveLocation 收货地址
     * @return 结果
     */
    @Override
    public int insertCcsReceiveLocation(CcsReceiveLocation ccsReceiveLocation)
    {
        return ccsReceiveLocationMapper.insertCcsReceiveLocation(ccsReceiveLocation);
    }

    /**
     * 修改收货地址
     *
     * @param ccsReceiveLocation 收货地址
     * @return 结果
     */
    @Override
    public int updateCcsReceiveLocation(CcsReceiveLocation ccsReceiveLocation)
    {
        return ccsReceiveLocationMapper.updateCcsReceiveLocation(ccsReceiveLocation);
    }

    /**
     * 批量删除收货地址
     *
     * @param ids 需要删除的收货地址主键
     * @return 结果
     */
    @Override
    public int deleteCcsReceiveLocationByIds(Long[] ids)
    {
        return ccsReceiveLocationMapper.deleteCcsReceiveLocationByIds(ids);
    }

    /**
     * 删除收货地址信息
     *
     * @param id 收货地址主键
     * @return 结果
     */
    @Override
    public int deleteCcsReceiveLocationById(Long id)
    {
        return ccsReceiveLocationMapper.deleteCcsReceiveLocationById(id);
    }
}
